<?php

namespace app\admin\model\vip;

use think\Model;

/**
 * Upgrade
 */
class Upgrade extends Model
{
    // 表名
    protected $name = 'vip_upgrade';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 字段类型转换
    protected $type = [
        'pay_time' => 'timestamp:Y-m-d H:i:s',
    ];


    public function member(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Member::class, 'member_id', 'id');
    }

    public function oldVipCard(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\vip\Card::class, 'old_vip_card_id', 'id');
    }

    public function newVipCard(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\vip\Card::class, 'new_vip_card_id', 'id');
    }
}